// pages/constmer/user/index.js
var api = require("../../../../api.js"),app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    phoneNumber: ''
  },
  navToUser: function(){
    wx.navigateTo({
      url: '/service/pages/constmer/user-info/index',
    })
  },
  callPhone: function () {
    var that = this;
    wx.makePhoneCall({
      phoneNumber: that.data.phoneNumber,
    })
  },
  onShow:function(){
    var that = this 
    var head = ''
    var nickname = ''
    that.setData({
      head : wx.getStorageSync('head'),
      nickname: wx.getStorageSync('nickname')
    }) 
    app.request({
      url: api.default.userinfos,
      method: 'post',
      data: {
        uid: wx.getStorageSync('uid')
      },
      success:function(e){
       if(e.code==1){
         that.setData({
           userinfo: e.data
         })
       }else{
        console.log('获取用户信息失败');
       }
      }
      });
  },
  onLoad:function(){
    var that = this
    that.setData({
      icons: wx.getStorageSync('site') + '/addons/sd_liferuning/tp/public/uploads/background',
    })
  }
})